1. Technology Field
The present invention is related to a data management method for a flash memory storage system, and more particularly, to a data management method for a flash memory storage system having a cache memory, and a flash memory storage system and a flash memory controller using the same, which may effectively shorten a time required for flushing temporary data in the cache memory.
2. Description of Related Art
The growth of digital cameras, mobile phones, and MP3 players has been rapid in recent years. Consequently, demands of consumers for storage media of digital contents have increased tremendously. Flash memory is one of the most adaptable storage media to be carried around and used for storing digital files due to its characteristics such as data non-volatility, low power consumption, small volume, and non-mechanical structure. A Solid State Drive (SSD) is an example of utilizing the flash memory as the storage media, and has been widely applied in the host system as a main disk.
Generally speaking, in designs of a flash memory storage system, physical blocks of the flash memory storage system are grouped into a plurality of physical units and the physical units are further grouped into a data area and a spare area. The physical units in the data area are used for storing valid data written by a writing command, and the physical units in the spare area are used for replacing the physical units in the data area during the execution of the writing command. More specifically, when receiving the writing command from a host to write data into the physical units to be updated in the data area, the flash memory storage system first selects one physical unit from the spare area, copies valid old data of the physical unit to be updated in the data area, and writes the copied valid old data together with the new data to be written into the physical unit selected from the spare area. Then, the flash memory storage system links the physical unit containing the new data to the data area, and erases the physical unit to be updated and links it to the spare area. To enable the host to properly access the physical units that store data in an alternate manner, the flash memory storage system provides logical units to the host. That is, the flash memory storage system records and updates a relationship between the logic units and the physical units of the data area in the logical address-physical address mapping table to reflect the alternation of the physical units. Therefore, the host is only required to perform writing based on the logical units provided and the flash memory storage system reads data from or writes data into the physical units according to the logical address-physical address mapping table.
However, compared with operations of the host system (e.g., data transmission), time required by writing data for a flash memory storage device to perform the above-described the alternation of the physical units is relatively longer, therefore, in order to enhance performance of the flash memory storage device, a cache memory is generally allocated in the flash memory storage device for shortening time required for completing related commands.
For example, in a case where the flash memory storage device takes relatively more time to complete the writing commands from the host system, when the host system issues the write command, the flash memory storage system may temporarily stores the data, which is to be written, into the cache memory, and replies the host system that the writing command is completed. Afterwards, when the cache memory is fully stored with the data, the flash memory storage device then writes the data into the flash memory.
However, in a framework of adding the cache memory for accessing the flash memory storage device, in a case where a great quantity of data is temporarily stored in the cache memory, or the data temporarily stored in the cache memory will be written into a plurality of different logical units, when the host system issues a command for flushing the cache memory, the flash memory storage device takes a very long time for writing the data temporarily stored in the cache memory into the physical units, thereby causing a severe delay on operations of the host system.